home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 551 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  4.1 KB

  1. Subject: Re: pipes & ptys
  2. Date: Sat, 16 Oct 93 23:30:46 CET
  3. From: Juergen Lock <nox@jelal.north.de>
  4. In-Reply-To: <9310141200.AA26776@amsel.techfak.uni-bielefeld.de>; from "itschere@TechFak.Uni-Bielefeld.DE" at Oct 14, 93 1:00 pm
  5. Message-Id: <9310162230.AA00340@jelal.north.de>
  6.  
  7. itschere@TechFak.Uni-Bielefeld.DE writes:
  8. > Hi everywhere,
  9. >   After having played a bit with the VDI version of MGR - and wondering
  10. > about why it is so slow when more than one window is open - I've hacked
  11. > a small experimental version of a window manager. Just one window which
  12. > can't be resized or removed, just to see what speed _can_ be achieved.
  13. >   Since some says it's so much optimized that I doubt I can get graphics
  14.                days? :)
  15. > output any faster ;-) But still it is not very much faster than the MGR.
  16. >   When trying to track down the problem, I stumbled over the pipes through
  17. > which data gets passed. Normally they're resonably fast, say, fast enough.
  18. > But if I open a pipe as a pseudo tty and use 1 Bytes reads/writes - which
  19. > looks normal for shell i/o to me
  20.  
  21.  hmm user processes doing 1 byte read()/write()s _is_ slow. :(  system
  22. calls are expensive...  (and also the library adds its share too...)
  23.  
  24.  example, take the difference between curses+mintlibs and curses+gnulib.
  25. i think what makes gnulib-linked curses programs look so sloow is
  26. only gnulibs console write() turns everything into 1-byte writes.
  27. curses+mintlib is already faster with MiNT than without... (at least
  28. for me on /dev/fasttext or /dev/vt* :-)
  29.  
  30. >  - I can't even get 1K/sec through it, and
  31. > all this on a TT. Is there really so much overhead in the tty routines in
  32. > tty.c? Mightn't this perhaps be worth improoving, since not just MGR or
  33. > my tricky window manager suffer from this bottleneck, but everything else
  34. > which works with pseudo ttys also...
  35. >   Anybody likes to start a discussion about that?
  36.  
  37.  not sure how much can be done about 1-byte IO (i fear the library
  38. and system call overhead are the biggest part already...)  i think the
  39. first thing to do would be change gnulib and all your other programs
  40. that still do it to avoid 1-byte IO where possible. (might need a few
  41. if (__mint) and Fcntls on ttys but the result should be worth it...)
  42. and then improve tty.c&friends so that long read/writes can get _really_
  43. efficient.  currently the problem is they do a lot of device-level
  44. 1-char IO and shuffling bytes into 32-bit `chars' and back... i.e. when a
  45. pty slave writes 1k that gets expanded into 4k, and when the master then
  46. does a 1k read its collapsed again.  and whats worse pipefs' read then
  47. gets called a 1000 times!  instead of once.  that is what makes ptys
  48. slow... (and serial ports too, but i said that before. :)
  49.  
  50.  now how fix this (i mean _really_ fix this. so that a 1k read ends up
  51. as one 1k device read whenever possible, without additional moving data
  52. around) and stay compatible with existing devices?  here is an idea...
  53.  
  54. 1. add 2 optional functions to DEVDRV struct, for now i call them bread
  55. and bwrite. (NULL means they are not there)  they work like device read
  56. and write, only with bytes instead of longs.  (btw there are 3 longs
  57. reserved in DEVDRV now and i can think of atleast 2 more functions to
  58. add later, readv and writev...  so extend the struct somehow?)
  59.  
  60. 2. if bwrite is there use it instead of write in tty_write (also in
  61. bflush, midiws...), if the write is RAW just check for job control and
  62. return (*f->dev->bwrite)(f, buf, nbytes);
  63.  and if bread is there do the same atleast for RAW reads in tty_read.
  64. (this includes reading pty masters...)
  65.  
  66. 3. add bread and bwrite functions to the pty device.  the slaves output
  67. pipe can then be changed to use bytes directly. (i think.  the other
  68. direction of course not...)
  69.  
  70. 4. add support for CLOCAL, HUPCL, VMIN etc and make _real_ modem devices...
  71. with bread/bwrite they finally could get decent thruput without 99% CPU load.
  72.  
  73.  this is just an idea i got and i have no idea if and when i could do
  74. all this... :)  but what do you think?
  75.  
  76.  cheers
  77.     Juergen
  78. -- 
  79. J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
  80.                                 ...ohne Gewehr
  81. PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA 
  82.